var express = require('express');
var router = express.Router();
// 文章的发布
/* 
  userid、title、content
*/
router.post('/',async  function(req, res, next) {
  console.log(req.body)
  console.log(req.auth);
  res.send({
    code:1,
    data:'文章发布成功'
  });
});

/* 
  根据用户的id查询全部文章
  /:uid
*/
router.get('/users/:uid',async  function(req, res, next) {
  console.log(req.params)
  res.send({
    code:1,
    data:'根据用户的id查询全部文章'
  });
});

/* 
// 根据文章id查看文章详情
/:aid
*/

router.get('/:aid',async  function(req, res, next) {
  console.log(req.params)
  res.send({
    code:1,
    data:'根据文章id查看文章详情'
  });
});

/* 
  根据文章id 删除本文章
*/

router.delete('/:aid',async  function(req, res, next) {
  console.log(req.params)
  res.send({
    code:1,
    data:'根据文章id删除本文章'
  });
});


/* 
  根据文章id 修改本文章

*/
router.patch('/:aid',async  function(req, res, next) {
  console.log(req.params)
  console.log(req.body.title)
  console.log(JSON.parse(JSON.stringify(req.body)))
  res.send({
    code:1,
    data:'根据文章id修改本文章'
  });
});

module.exports = router;
